home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_rotatetrap.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  209 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_RotateTrap.cog
  4. #
  5. # [TL] [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.     message    startup
  12.     message    entered
  13.     message    exited
  14.     message    pulse
  15.     message    crossed
  16.     message    arrived
  17.     message    blocked
  18.  
  19.     thing    player                local
  20.  
  21.     thing    front1                linkid=5
  22.     thing    front0                linkid=5
  23.     thing    center
  24.     thing    back0                linkid=5
  25.     thing    back1                linkid=5
  26.  
  27.     sound    teeterSnd=teo_gears_slide_c.wav        local
  28.     int        teeterTrack=-1                        local
  29.  
  30.     surface    crossenter0
  31.     surface    crossexit0
  32.     surface    crossenter1
  33.     surface    crossexit1
  34.  
  35.     flex    rval=0.35            local        #was .25
  36.     flex    gval=0.35            local        #was .25
  37.     flex    bval=0.45            local        #was .35
  38.     flex    radius=0.01            local        #was .1
  39.     flex    speed=1.0            local
  40.  
  41.     flex    oneSpeed=2.5        local
  42.     flex    zeroSpeed=5.0        local    
  43.     flex    centerSpeed=10.0    local
  44.  
  45.     vector    color                local
  46.  
  47.     int        sliding=0            local
  48.  
  49. end
  50.  
  51. # ========================================================================================
  52. code
  53.  
  54. startup:
  55.     player = GetLocalPlayerThing();
  56.     color = VectorSet(rval, gval, bval);
  57.  
  58.     SetThingLight(front1, color, radius, speed);
  59.     SetThingLight(front0, color, radius, speed);
  60.     SetThingLight(center, color, radius, speed);
  61.     SetThingLight(back0, color, radius, speed);
  62.     SetThingLight(back1, color, radius, speed);
  63.  
  64.     AttachThingToThing(front1, center);
  65.     AttachThingToThing(front0, center);
  66.  
  67.     AttachThingToThing(back0, center);
  68.     AttachThingToThing(back1, center);
  69.  
  70.     return;
  71.  
  72. # ........................................................................................
  73. crossed:
  74.  
  75.     oneSpeed = (2.5 - ((GetDifficulty()) * 0.25));                #was * .2
  76.     zeroSpeed = (7.0 - ((GetDifficulty()) * 0.25));                #was * .2 AND initial number was 5
  77.     CenterSpeed = (10.0 - ((GetDifficulty()) * 0.25));            #was * .2
  78.  
  79.  
  80.     if (GetSenderRef() == crossenter0)
  81.     {
  82.         SetPulse(0.5);
  83.     }
  84.  
  85.     if (GetSenderRef() == crossexit0)
  86.     {
  87.         SetPulse(0.0);
  88.         StopThing(center);
  89.         RotateToPYR(center, '0.0 0.0 0.0', centerSpeed);
  90.     }
  91.  
  92.     if (GetSenderRef() == crossenter1)
  93.     {
  94.         SetPulse(0.5);
  95.     }
  96.  
  97.     if (GetSenderRef() == crossexit1)
  98.     {
  99.         SetPulse(0.0);
  100.         StopThing(center);
  101.         RotateToPYR(center, '0.0 0.0 0.0', centerSpeed);
  102.     }
  103.  
  104.     return;
  105.  
  106. # ........................................................................................
  107. entered:
  108.  
  109.     oneSpeed = (2.5 - ((GetDifficulty()) * 0.25));                #was * .2
  110.     zeroSpeed = (7.0 - ((GetDifficulty()) * 0.25));                #was * .2 AND initial number was 5
  111.     CenterSpeed = (10.0 - ((GetDifficulty()) * 0.25));            #was * .2
  112.  
  113.  
  114.  
  115.     Print("diff = ");
  116.     PrintInt(getdifficulty());
  117.  
  118.     Print("onespeed = ");
  119.     PrintFlex(onespeed);
  120.     Print("zerospeed = ");
  121.     PrintFlex(zerospeed);
  122.     Print("centerspeed = ");
  123.     PrintFlex(centerspeed);
  124.  
  125.     if (sliding == 1)
  126.         return;
  127.  
  128.     if (GetSourceRef() == player)
  129.     {
  130.         if (GetSenderRef() == front1)
  131.         {
  132.             RotateToPYR(center, '0.0 0.0 -90.0', oneSpeed);
  133.         }    
  134.  
  135.         if (GetSenderRef() == front0)
  136.         {
  137.             RotateToPYR(center, '0.0 0.0 -90.0', zeroSpeed);
  138.         }    
  139.  
  140.         if (GetSenderRef() == center)
  141.         {
  142.             RotateToPYR(center, '0.0 0.0 0.0', centerSpeed);
  143.         }    
  144.  
  145.         if (GetSenderRef() == back0)
  146.         {
  147.             RotateToPYR(center, '0.0 0.0 90.0', zeroSpeed);
  148.         }    
  149.  
  150.         if (GetSenderRef() == back1)
  151.         {
  152.             RotateToPYR(center, '0.0 0.0 90.0', oneSpeed);
  153.         }    
  154.  
  155.         if (teeterTrack == -1)
  156.             teeterTrack = PlaySoundThing(teeterSnd, center, 1, -1.0, -1.0, 0x801);
  157.     }
  158.  
  159. return;
  160.  
  161. # ........................................................................................
  162. exited:
  163.  
  164.     oneSpeed = (2.5 - ((GetDifficulty()) * 0.25));                #was * .2
  165.     zeroSpeed = (7.0 - ((GetDifficulty()) * 0.25));                #was * .2 AND initial number was 5
  166.     CenterSpeed = (10.0 - ((GetDifficulty()) * 0.25));            #was * .2
  167.  
  168.  
  169.     if (sliding == 1)
  170.         return;
  171.  
  172.     if (GetSourceRef() == player)
  173.     {
  174.         if (GetSenderId() == 5) 
  175.         {
  176.             Sleep(1.0);
  177.             RotateToPYR(center, '0.0 0.0 0.0', centerSpeed);
  178.             Sleep(0.25);
  179.  
  180.                if (teeterTrack == -1)
  181.                 teeterTrack = PlaySoundThing(teeterSnd, center, 1, -1.0, -1.0, 0x801);
  182.         }    
  183.     }
  184.  
  185.     return;
  186.  
  187. # ........................................................................................
  188. pulse:
  189.     if (GetMoveStatus(player) == 47)
  190.     {
  191.         sliding = 1;
  192.     }
  193.     return;
  194.  
  195. arrived:
  196.     if (GetSenderRef() == center)
  197.     {
  198.         if (teeterTrack != -1)
  199.         {
  200.             StopSound(teeterTrack, 0.5);
  201.             teeterTrack = -1;
  202.         }
  203.     }
  204.     return;
  205.  
  206. # ........................................................................................
  207. end
  208.  
  209.